package com.forenow.demo.IOtest;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Test {

    public static void main(String[] args) {
        List<Student> list=new ArrayList<>();
        Operator operator=new Operator();
        int i=0;
        while (i<3){
            System.out.println("输入三次学生信息");
            Scanner input=new Scanner(System.in);
            System.out.println("输入id");
            int sid = input.nextInt();
            System.out.println("输入姓名");
            String sname = input.next();
            System.out.println("输入年龄");
            int sage = input.nextInt();
            System.out.println("输入输入学校");
            String school = input.next();
            Student stu=new Student(sid,sname,sage,school);
            list.add(stu);
            i++;
        }
        boolean isRight = operator.write(list,"Student.txt");
        if (isRight) {
            System.out.println("输入数据成功");
        }else {
            System.out.println("输入数据失败");
        }
        operator.read("Student.txt");
    }
}
